package com.lili.collection.core.context.impl;

import com.lili.collection.core.context.SingleRecordContext;
import com.lili.collection.core.error.StageRecordException;
import com.lili.collection.core.record.Record;
import lombok.Getter;
import lombok.Setter;

/**
 * 通用单记录上下文
 *
 * @author lili
 * @date 2023/3/7 23:00
 * @description 通用单记录上下文
 */
public class GenericSingleRecordContext implements SingleRecordContext {

    @Getter
    @Setter
    private int index;

    @Setter
    private Record record;

    @Getter
    @Setter
    private StageContextState stageContextState;

    @Getter
    @Setter
    private StageRecordState stageRecordState;

    @Getter
    @Setter
    private StageRecordException exception;

    public GenericSingleRecordContext() {
        this.index = 0;
    }

    @Override
    public Record getOutput() {
        return this.record;
    }

    @Override
    public void clear() {
        this.exception = null;
        this.record = null;
    }
}
